---
import { getLanguageFromURL } from '~/util';
import { useTranslations } from '~/i18n/util';
import CardsNav from './NavGrid/CardsNav.astro';
import type { LogoKey } from '~/data/logos';

export interface Props {
	minimal?: boolean;
}

const { minimal } = Astro.props as Props;

const lang = getLanguageFromURL(Astro.url.pathname);
const t = useTranslations(Astro);

interface Service {
	title: string;
	slug: LogoKey;
	supports: ['ssr', 'static'] | ['ssr'] | ['static'];
}

const services: Service[] = [
	{ title: 'Netlify', slug: 'netlify', supports: ['ssr', 'static'] },
	{ title: 'Vercel', slug: 'vercel', supports: ['ssr', 'static'] },
	{ title: 'Deno Deploy', slug: 'deno', supports: ['ssr'] },
	{ title: 'GitHub Pages', slug: 'github', supports: ['static'] },
	{ title: 'GitLab Pages', slug: 'gitlab', supports: ['static'] },
	{ title: 'Cloudflare Pages', slug: 'cloudflare', supports: ['ssr', 'static'] },
	{ title: 'AWS', slug: 'aws', supports: ['static'] },
	{ title: 'AWS via Flightcontrol', slug: 'flightcontrol', supports: ['ssr', 'static'] },
	{ title: 'AWS via SST', slug: 'sst', supports: ['ssr', 'static'] },
	{ title: 'Google Cloud', slug: 'google-cloud', supports: ['ssr', 'static'] },
	{ title: 'Firebase Hosting', slug: 'google-firebase', supports: ['ssr', 'static'] },
	{ title: 'Heroku', slug: 'heroku', supports: ['static'] },
	{ title: 'Microsoft Azure', slug: 'microsoft-azure', supports: ['static'] },
	{ title: 'Buddy', slug: 'buddy', supports: ['static'] },
	{ title: 'Edgio', slug: 'edgio', supports: ['ssr', 'static'] },
	{ title: 'Render', slug: 'render', supports: ['static'] },
	{ title: 'Stormkit', slug: 'stormkit', supports: ['static'] },
	{ title: 'Surge', slug: 'surge', supports: ['static'] },
	{ title: 'Cleavr', slug: 'cleavr', supports: ['ssr', 'static'] },
	{ title: 'Kinsta', slug: 'kinsta', supports: ['ssr', 'static'] },
	{ title: 'Deta Space', slug: 'space', supports: ['ssr', 'static'] },
	{ title: 'Zeabur', slug: 'zeabur', supports: ['ssr', 'static'] },
];
---

<CardsNav
	minimal={minimal}
	links={services.map(({ title, slug, supports }) => ({
		title,
		href: `/${lang}/guides/deploy/${slug}/`,
		logo: slug,
		tags: Object.fromEntries(supports.map((s) => [s, t(`deploy.${s}Tag`)!])),
	}))}
/>
